//
//  FightTreasureViewController.m
//  Associated Press indiana
//
//  Created by MK-MAC-002 on 15/7/17.
//  Copyright (c) 2015年 客官大大. All rights reserved.
//

#import "FightTreasureViewController.h"
#import "MMDrawerBarButtonItem.h"
#import "UIViewController+MMDrawerController.h"
#import "CollectionViewCell.h"
#import "FightTableViewCell.h"
#import "JiangpinXiangqingViewController.h"
@interface FightTreasureViewController ()<UITableViewDelegate,UITableViewDataSource>

@end

@implementation FightTreasureViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"一元夺宝";
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],UITextAttributeTextColor,nil]];
//        [self setupLeftMenuButton];
    [self create];

}
-(void)create
{

//        UICollectionViewFlowLayout *laout = [[UICollectionViewFlowLayout alloc] init];
//        laout.itemSize = CGSizeMake(187.5, 187.5);
//        laout.scrollDirection = UICollectionViewScrollDirectionVertical;
//        laout.minimumInteritemSpacing = 0;
//        laout.minimumLineSpacing = 0;
//        self.collectionview = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) collectionViewLayout:laout];
//        _collectionview.delegate = self;
//        _collectionview.dataSource = self;
//        [_collectionview registerClass:[CollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
//        _collectionview.backgroundColor = [UIColor whiteColor];
//        _collectionview.pagingEnabled = NO;
//
//    laout.headerReferenceSize = CGSizeMake(375, 150);
//    [_collectionview registerClass:[UICollectionViewCell class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"headerResus"];
//    
//        [self.view addSubview:_collectionview];
    UITableView *table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 375, 618) style:UITableViewStyleGrouped];
    table.delegate = self;
    table.dataSource = self;
    UIView *top = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 375, 100)];
    top.backgroundColor = [UIColor grayColor];
    table.tableHeaderView = top;
    [self.view addSubview:table];
    UIButton *bu = [UIButton buttonWithType:UIButtonTypeCustom];
    bu.backgroundColor = [UIColor blackColor];
    bu.frame = CGRectMake(100, 50, 10, 10);
    [bu addTarget:self action:@selector(bu) forControlEvents:UIControlEventTouchUpInside];
    [table addSubview:bu];
    

}
-(void)bu
{
    JiangpinXiangqingViewController *j = [[JiangpinXiangqingViewController alloc] init];
    self.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:j animated:YES];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *indent = @"cell";
    FightTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indent];
    if (cell == nil) {
        cell = [[FightTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indent];
    }
    return cell;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

    return 1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 618;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
// 分区的高度

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 40;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
    view.backgroundColor = [UIColor redColor];
    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
    button1.frame = CGRectMake(50, 0, 10, 10);
    button1.backgroundColor = [UIColor grayColor];
    [view addSubview:button1];
    return view;
    
    
}
//-(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
//{
//    if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
//        UICollectionReusableView *resuseview = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"headerResus" forIndexPath:indexPath];
//        UIScrollView *scro = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 375, 150)];
//        scro.backgroundColor = [UIColor yellowColor];
//        
//        
//        UIImage *image = [UIImage imageNamed:@"1.jpg"];
//        UIImageView *i1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 375, 150)];
//        i1.image = image;
//        [scro addSubview:i1];
//        UIImage *imag1 = [UIImage imageNamed:@"2.jpg"];
//        UIImageView *i2 = [[UIImageView alloc] initWithFrame:CGRectMake(375, 0, 375, 150)];
//        i2.image = imag1;
//        [scro addSubview:i2];
//        UIImage *imag3 = [UIImage imageNamed:@"3.jpg"];
//        UIImageView *i3 = [[UIImageView alloc] initWithFrame:CGRectMake(750, 0, 375, 150)];
//        i3.image = imag3;
//        [scro addSubview:i3];
//        [resuseview addSubview:scro];
//        //非常重要的一个属性
//        scro.contentSize = CGSizeMake(self.view.frame.size.width*3, 150);
//        
//        //分页滑动
//        scro.pagingEnabled = YES;
//        
//        //不要scroview弹
//        scro.bounces = NO;
//        
//        //又一个非常终于的属性(偏移量)
//        [scro setContentOffset:CGPointMake(0, 0)];
//        
//        
//       scro.delegate = self;
//        return resuseview;
//    }
//    return nil;
//}
//-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
//{
//    return 10;
//}
//-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
//{
//    UINib *nib = [UINib nibWithNibName:@"CollectionViewCell" bundle:[NSBundle mainBundle]];
//    [_collectionview registerNib:nib forCellWithReuseIdentifier:@"collectioncell"];
//    CollectionViewCell *cell = [[CollectionViewCell alloc]init];
//    cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"collectioncell" forIndexPath:indexPath];
////    CollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
////cell = [[[NSBundle mainBundle] loadNibNamed:@"CollectionViewCell" owner:self options:nil]lastObject];
//    cell.picer.image = [UIImage imageNamed:@"WeChat_1437377930.jpeg"];
//    [cell.button addTarget:self action:@selector(jiatu) forControlEvents:UIControlEventTouchUpInside];
////    cell.name.text = @"pingg";
//    
//    return cell;
//}
//-(void)jiatu
//{
//    NSLog(@"ddddddddddddddddddddddddd");
//}
//-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
//{
//    NSLog(@"%ld", indexPath.row);
//}
//-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
//{
//    return 1;
//}
//
//- (void)didReceiveMemoryWarning {
//    [super didReceiveMemoryWarning];
//    // Dispose of any resources that can be recreated.
//}
//-(void)setupLeftMenuButton{
//    MMDrawerBarButtonItem * leftDrawerButton = [[MMDrawerBarButtonItem alloc] initWithTarget:self action:@selector(leftDrawerButtonPress:)];
//    [self.navigationItem setLeftBarButtonItem:leftDrawerButton animated:YES];
//}
//-(void)leftDrawerButtonPress:(id)sender{
//    [self.mm_drawerController toggleDrawerSide:MMDrawerSideLeft animated:YES completion:nil];
//}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
